﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Castle.MicroKernel.Registration;
using System.Web.Mvc;
using Castle.Windsor;
using Castle.MicroKernel.SubSystems.Configuration;
using Shop.Managers;
using Data.Repositories;

public class RepositoriesInstaller : IWindsorInstaller
{
    public void Install(IWindsorContainer container, IConfigurationStore store)
    {
        container.Register(Classes.FromAssemblyNamed("Data")
                .Where(Component.IsInSameNamespaceAs<ProductsRepository>())
                .WithService.DefaultInterfaces()
                .LifestylePerWebRequest());

        container.Register(Classes.FromAssemblyNamed("Data")
                .Where(Component.IsInSameNamespaceAs<BasketRepository>())
                .WithService.DefaultInterfaces()
                .LifestylePerWebRequest());

        container.Register(Classes.FromAssemblyNamed("Data")
                .Where(Component.IsInSameNamespaceAs<CategoriesRepository>())
                .WithService.DefaultInterfaces()
                .LifestylePerWebRequest());

        container.Register(Classes.FromAssemblyNamed("Data")
                .Where(Component.IsInSameNamespaceAs<UserRepository>())
                .WithService.DefaultInterfaces()
                .LifestylePerWebRequest());
    }
}